package cn.rocky.offer;

public class offer58 {

    public String reverseLeftWords(String s,int n) {
        return s.substring(n,s.length()) + s.substring(0,n);
    }

    public String reverseLeftWords1(String s,int n) {
        StringBuilder res = new StringBuilder();
        for (int i = n; i < s.length(); i++) {
            res.append(s.charAt(i));
        }
        for (int i = 0; i < n; i++) {
            res.append(s.charAt(i));
        }
        return res.toString();
    }

    public static void main(String[] args) {
        String s = "abcdefg";
        int k = 2;
        offer58 offer58 = new offer58();
        String s1 = offer58.reverseLeftWords(s, k);
        System.out.println(s1);
    }
}
